// 重新封装axios
define(['../utiltool/axios/dist/axios.min'], function (axios) {
	// 暴露出封装好的axios方法，方便接口的统一规划
	return function (callback, params) {
		var setting = params.setting;
		if(typeof setting !== 'object') {
			var req = {
				msg: '请求错误',
				code: 888,
				data: null
			};
			return callback(req);
		}
		if(this.$Loading) {
			this.$Loading.start();
		}
		return axios({
			method: setting.method,
			timeout: 5000*10,
			url: setting.url,
			data: params.data ? params.data : null,
			contentType: setting.contentType ? setting.contentType : null
		}).then(
			function (res) {
				var code = res.data.code;
				res = res.data;
				if(this.$Loading) {
					if(code === 0) this.$Loading.finish();
					else this.$Loading.error();
				}
				callback(res);
			}.bind(this),
			function (res) {
				var req = {
					msg: '网络错误',
					code: 999,
					data: null
				};
				if(this.$Loading) {
					this.$Loading.error();
				}
				callback(req);
			}.bind(this)
		);
	}
})